







[This topic is pre-release documentation and is subject to change in future releases. Blank topics are included as placeholders.]
Returns a view onto a sub-range of an array. Items from array are not copied; the
returned IList<T> is simply a different view onto the same underlying items. Changes to array
are reflected in the view, and vice versa. Insertions and deletions in the view change the size of the
view. After an insertion, the last item in array "falls off the end". After a deletion, the
last item in array becomes the default value (0 or null).
Namespace: Wintellect.PowerCollections
Assembly:
PowerCollections (in PowerCollections.dll)
Syntax
C# |
---|
public static IList<T> Range<T>( T[] array, int start, int count ) |
Visual Basic (Declaration) |
---|
Public Shared Function Range(Of T) ( _ array As T(), _ start As Integer, _ count As Integer _ ) As IList(Of T) |
Visual C++ |
---|
public: generic<typename T> static IList<T>^ Range ( array<T>^ array, int start, int count ) |
Parameters
- array
- array<T>[]()
The array to view.
- start
- Int32
The starting index of the view.
- count
- Int32
The number of items in the view.
Return Value
A list that is a view onto the given sub-array.
Type Parameters
- T
Remarks
This method can be used to apply an algorithm to a portion of a array. For example:
will reverse the 6 items beginning at index 3.
![]() | |
---|---|
Algorithms.ReverseInPlace(Algorithms.Range(array, 3, 6)) |
Exceptions
Exception | Condition |
---|---|
System..::ArgumentNullException | array is null. |
System..::ArgumentOutOfRangeException | start or count is negative. |
System..::ArgumentOutOfRangeException | start + count is greater than the size of array. |
See Also
Algorithms Class
Wintellect.PowerCollections Namespace